<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{:lang('admin')[CONTROLLER_NAME.'-'.ACTION_NAME]}</title>
    <link href="__STATIC__/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__STATIC__/css/animate.min.css" rel="stylesheet">
    <link href="__STATIC__/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <script>if (window.top !== window.self) {
        window.top.location = window.location;
    }</script>
</head>

<body class="gray-bg">

<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <div>
            <h1 class="logo-name">{:lang('backend manage system')}</h1>
        </div>
        <h3>{:lang('welcome')}</h3>

        <form class="m-t" role="form" action="" id="form1">
            <div class="form-group">
                <input type="text" name="adminName" class="form-control input-lg m-b" placeholder="{:lang('username')}">
            </div>
            <div class="form-group">
                <input type="password" name="adminPwd" class="form-control input-lg m-b" placeholder="{:lang('password')}">
            </div>
            <div class="form-group row">
                <div class="col-sm-7" style="padding-right: 0;">
                    <input type="text" class="form-control input-lg m-b" name="verifyCode" placeholder="{:lang('verify code')}">
                </div>
                <div class="col-sm-5" style="padding-left: 0;">
                    <img class="input-lg" style="width: 100%;padding: 1px;"
                         onclick="this.src='{:U('admin/admin/verifyCode')}'+'/'+Math.random()"
                         src="{:U('admin/admin/verifyCode')}"
                         id="verifyCode">
                </div>


            </div>
            <button type="button" class="btn btn-primary block full-width m-b" onclick="doLogin()">{:lang('log in')}</button>
        </form>
    </div>
</div>
<script src="__STATIC__/js/jquery.min.js?v=2.1.4"></script>
<script src="__STATIC__/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__ROOT__/static/layer/layer.js"></script>
<script>
    function doLogin() {
        $.ajax({
            url: "{:U('Admin/login')}",
            type: 'post',
            data: $('#form1').serialize(),
            dataType: 'JSON',
            success: function (data) {
                if (data.status == 1) {
                    layer.msg(data.msg);
                    setTimeout(function () {
                        location.href = '{:U("index/index")}'
                    }, 1000);
                } else {
                    layer.msg(data.msg);
                    $('#verifyCode').attr('src', "{:U('admin/admin/verifyCode')}/'" + Math.random())
                }
            }
        });
        return false;
    }
</script>
</body>

</html>
